import Mock from "mockjs";
Mock.setup({
  timeout : '200-600'
});
let apiList: [string , () => unknown | object][] = [];
const modules = require.context('./modules' , true , /\.ts$/);
const files = modules.keys();
files.forEach(path => {
  const moduleObj = modules(path) as {default: Record<string , () => unknown | object>};
  const list = Object.entries(moduleObj.default);
  apiList = apiList.concat(list);
})
apiList.forEach(([path , result]) => {
  const protocol = path.split('|');
  const [ method , url ] = protocol;
  Mock.mock(new RegExp('^' + url) , method , result);
});